package com.xbongbong.saas.enums.business;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.enums.ScreenTypeEnum;
import com.xbongbong.paas.enums.SheetTypeEnum;
import com.xbongbong.saas.constant.PaymentConstant;
import com.xbongbong.saas.enums.SetTypeEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * 付款单枚举
 *
 * @author feng.zheng
 * @version v1.0
 * @date 2019/1/14 15:37
 * @since v1.0
 */
@Getter
public enum PaySheetEnum {
    // 付款计划模板设置界面展示字段
    BASE_INFO("other_1", "enum.paySheet.attrName.base_info", "baseInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 10000, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    PAY_PLAN_NO("serialNo", "enum.paySheet.attrName.pay_plan_no", "payPlanNo", FieldTypeEnum.SERIALNO.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9990, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    //回、付款单字段attr都统一用PaymentConstant.ATTR_SHEET_TYPE，即 text_10
    PAY_SHEET_TYPE(PaymentConstant.ATTR_SHEET_TYPE, "enum.paySheet.attrName.pay_sheet_type", "paySheetType", FieldTypeEnum.COMBO.getType(), 1, 0, 0, ShowTypeEnum.LIST_DETAIL.getCode(), 9980, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    LINK_SUPPLIER("text_4", "enum.paySheet.attrName.link_supplier", "linkSupplier", FieldTypeEnum.LINK_BUSINESS_SINGLE.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9970, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    LINK_PURCHASE("text_5", "enum.paySheet.attrName.link_purchase", "linkPurchase", FieldTypeEnum.LINK_BUSINESS_MULTI.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9960, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    PAY_PLAN("text_6", "enum.paySheet.attrName.pay_plan", "payPlan", FieldTypeEnum.LINK_BUSINESS_MULTI.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9950, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    AMOUNT("num_1", "enum.paySheet.attrName.amount", "amount", FieldTypeEnum.NUM.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9940, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    WRITE_OFF_AMOUNT("num_2", "enum.paySheet.attrName.write_off_amount", "writeOffAmount", FieldTypeEnum.NUM.getType(), 1, 0, 0, ShowTypeEnum.LIST_DETAIL.getCode(), 9930, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    INVOICE_AMOUNT("num_3", "enum.paySheet.attrName.invoice_amount", "invoiceAmount", FieldTypeEnum.NUM.getType(), 1, 1, 0, ShowTypeEnum.LIST_DETAIL.getCode(), 9920, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    BELONG_ID("array_1", "enum.paySheet.attrName.belong_id", "belongId", FieldTypeEnum.USER_GROUP.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9910, 1, 1, ScreenTypeEnum.SCREEN_SEARCH.getType()),
    REAL_PAY_TIME("date_1", "enum.paySheet.attrName.real_pay_time", "realPayTime", FieldTypeEnum.DATETIME.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9900, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    FUND_ACCOUNT("text_13", "enum.paySheet.attrName.fund_account", "fundAccount", FieldTypeEnum.COMBO.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9890, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    PAY_TYPE("text_2", "enum.paySheet.attrName.pay_type", "payType", FieldTypeEnum.COMBO.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9880, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    SYSTEM_INFO("other_2", "enum.paySheet.attrName.system_info", "systemInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 9870, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    MEMO("text_8","enum.paySheet.attrName.memo","memo",FieldTypeEnum.TEXTAREA.getType(),3,0,0,ShowTypeEnum.ALL.getCode(),9860,1,0, ScreenTypeEnum.SCREEN_SHOW.getType()),
    FILE("file_1","enum.paySheet.attrName.file","file",FieldTypeEnum.UPLOAD.getType(),3,0,0,ShowTypeEnum.ALL.getCode(),9850,1,0, ScreenTypeEnum.SCREEN_OFF.getType()),
    ORIGIN_ID("text_15", "enum.paySheet.attrName.origin_id", "originId", FieldTypeEnum.LINK_BUSINESS_SINGLE.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9830, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    CREATOR_ID("creatorId", "enum.paySheet.attrName.creator_id", "creatorId", FieldTypeEnum.CREATORID.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9820, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    ADD_TIME("addTime", "enum.paySheet.attrName.add_time", "addTime", FieldTypeEnum.ADDTIME.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9810, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    UPDATE_TIME("updateTime", "enum.paySheet.attrName.update_time", "updateTime", FieldTypeEnum.UPDATETIME.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9800, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),

    OWNER_ID("ownerId", "enum.paySheet.attrName.owner_id", "ownerId", FieldTypeEnum.OWNERID.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9790, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),

    COUSERID("coUserId", "enum.paySheet.attrName.couserid", "coUserId", FieldTypeEnum.COUSERID.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9780, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),

    SUPPLIER_LINK_TEXT("text_9", "enum.paySheet.attrName.supplier_link_text", "supplierLinkText", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9790, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    PURCHASE_LINK_TEXT("text_11", "enum.paySheet.attrName.purchase_link_text", "purchaseLinkText", FieldTypeEnum.TEXTAREA.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9780, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    PAY_PLAN_LINK_TEXT("text_12", "enum.paySheet.attrName.pay_plan_link_text", "payPlanLinkText", FieldTypeEnum.TEXTAREA.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9770, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    ORIGIN_ID_LINK_TEXT("text_16", "enum.paySheet.attrName.origin_id_link_text", "originIdLinkText", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9750, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),

    //以下字段付款单改造时需要删掉，后续开发到一定程度即可删除
    ESTIMATE_TIME("date_2", "enum.paySheet.attrName.estimate_time", "estimateTime", FieldTypeEnum.DATETIME.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9950, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),


    //以下是冗余字段，用来占位，方便后续新增字段：后续扩展字段可以使用以下字段
    TEXT_17("text_17", "enum.paymentSheet.attrName.text_18", "", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    TEXT_18("text_18", "enum.paymentSheet.attrName.text_18", "", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    TEXT_19("text_19", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    TEXT_20("text_20", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    TEXT_21("text_21", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    TEXT_22("text_22", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    //num占位
    NUM_4("num_4", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.COMBO_NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    NUM_5("num_5", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.COMBO_NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    NUM_6("num_6", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.COMBO_NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    NUM_7("num_7", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.COMBO_NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    NUM_8("num_8", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.COMBO_NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    //date占位
    DATE_3("date_3", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.DATETIME.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    DATE_4("date_4", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.DATETIME.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    DATE_5("date_5", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.DATETIME.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    DATE_6("date_6", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.DATETIME.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    DATE_7("date_7", "enum.paymentSheet.attrName.text_19", "", FieldTypeEnum.DATETIME.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),

    FILE_2("file_2", "enum.paymentSheet.attrName.text_19", "file", FieldTypeEnum.UPLOAD.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    FILE_3("file_3", "enum.paymentSheet.attrName.text_19", "file", FieldTypeEnum.UPLOAD.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    FILE_4("file_4", "enum.paymentSheet.attrName.text_19", "file", FieldTypeEnum.UPLOAD.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    FILE_5("file_5", "enum.paymentSheet.attrName.text_19", "file", FieldTypeEnum.UPLOAD.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9000, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    ;

    /**
     * 英文名称
     */
    private String attr;
    /**
     * 中文名称
     */
    private String attrName;
    /**
     * 对应saas中的attr
     */
    private String saasAttr;
    /**
     * 字段类型，详见
     *
     * @see FieldTypeEnum
     */
    private Integer fieldType;
    /**
     * 重命名、判重、启用必填等权限
     * 1.重命名+字段权限
     * 2.重命名+字段权限+查重
     * 3.重命名+字段权限+启用、必填
     * 4.重命名+字段权限+查重+启用、必填
     * 注：pro中启用和必填是同一个权限，同时启用或同时关闭
     */
    private Integer setType;
    /**
     * 模板设计阶段字段是否允许编辑
     * 1：允许编辑
     * 0：不允许编辑
     */
    private Integer designEditable;
    /**
     * 字段是否显示在模板设计界面
     * 1：不显示
     * 0：显示
     */
    private Integer editHide;
    /**
     * 字段在各个界面（新建、编辑、列表、详情）的展现形式
     * 详见
     *
     * @see ShowTypeEnum
     */
    private Integer showType;
    /**
     * 字段在模板设计界面的排序
     * 建议不要用连续的数字，可以用等差数列，以防以后在两个字段之间加入新字段
     */
    private Integer sort;
    /**
     * 字段在各个界面是否可见(启用)
     * 1：可见
     * 0：不可见
     * 注：字段在具体页面的可见性需要用属性和showType联合判断，在visible=1的情况下判断showType
     */
    private Integer visible;
    /**
     * 字段是否必填
     * 1：必填
     * 0：不必填
     */
    private Integer required;

    /**
     * 筛选类型
     * 1：可筛选
     * 2：不可筛选
     */
    private Integer screenType;

    PaySheetEnum(String attr, String attrName, String saasAttr, Integer fieldType, Integer setType, Integer designEditable,
                 Integer editHide, Integer showType, Integer sort, Integer visible, Integer required, Integer screenType) {
        this.attr = attr;
        this.attrName = attrName;
        this.saasAttr = saasAttr;
        this.fieldType = fieldType;
        this.setType = setType;
        this.designEditable = designEditable;
        this.editHide = editHide;
        this.showType = showType;
        this.sort = sort;
        this.visible = visible;
        this.required = required;
        this.screenType = screenType;
    }

    /**
     * 对data内的字段拼上“data.”
     *
     * @param cache 当前枚举对象
     * @return java.lang.String
     * @author 徐俊杰
     * @date 2019/3/18 15:56
     * @since v1.0
     */
    public static String getAttrConnectData(PaySheetEnum cache) {
        return "data." + cache.getAttr();
    }

    /**
     * 获取es查询、聚合字段
     * data在库内是json对象，对data字段内某个key做es【精确查询】时，需要在其前拼上“data.”，且【text等类型的】要在后面拼“.keyword”
     *
     * @param cache 当前枚举对象
     * @return java.lang.String
     * @author 徐俊杰
     * @date 2019/3/18 15:57
     * @since v1.0
     */
    public static String getEsAttr4Keyword(PaySheetEnum cache) {
        FieldTypeEnum fieldTypeEnum = FieldTypeEnum.getFieldTypeEnum(cache.fieldType);
        //字段类型为text，或者字段在es内的类型时text，则需要在后面拼上“.keyword”
        boolean flag = fieldTypeEnum == FieldTypeEnum.TEXT || "text".equals(fieldTypeEnum.getEsalias());
        if (flag) {
            return "data." + cache.getAttr() + ".keyword";
        }
        return "data." + cache.getAttr();
    }

    /**
     * 流程中获取隐藏字段
     * @return
     */
    public static List<PaySheetEnum> getDisableField() {
        List<PaySheetEnum> paySheetEnums = new ArrayList<>();
        for (PaySheetEnum paySheetEnum : values()) {
            if (Objects.equals(paySheetEnum.getShowType(), ShowTypeEnum.NONE.getCode()) || Objects.equals(paySheetEnum.getEditHide(), 1)
                    || Objects.equals(paySheetEnum.getFieldType(), FieldTypeEnum.CREATORID.getType()) || Objects.equals(paySheetEnum.getFieldType(), FieldTypeEnum.ADDTIME.getType())) {
                paySheetEnums.add(paySheetEnum);
            }
        }
        return paySheetEnums;
    }

    /**
     * 把传入的字段（类型为LINK_BUSINESS_SINGLE）的转为其隐藏字段
     * @param attr 字段名
     * @return java.lang.String
     * @author zcp
     * @date 2019/7/4 15:31
     * @since v1.0
     * @version v1.0
     */
    public static String changeToHide4Link(String attr) {
        if (Objects.equals(attr, LINK_SUPPLIER.attr)) {
            return SUPPLIER_LINK_TEXT.attr;
        } else if (Objects.equals(attr, LINK_PURCHASE.attr)) {
            return PURCHASE_LINK_TEXT.attr;
        } else if (Objects.equals(attr, PAY_PLAN.attr)) {
            return PAY_PLAN_LINK_TEXT.attr;
        }
        return attr;
    }

    /**
     * app端默认标题显示字段
     * @return java.util.List<java.lang.Object>
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    public static List<Object> getTitleAttrList() {
        return Collections.singletonList(PAY_PLAN_NO);
    }

    /**
     * app端默认摘要
     * @return java.util.List<java.lang.Object>
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    public static List<Object> getSummaryAttrList() {
        return Arrays.asList(LINK_SUPPLIER, LINK_PURCHASE, AMOUNT, REAL_PAY_TIME, BELONG_ID);
    }

    /**
     * 得到所有的字段attr
     * @return java.util.List<java.lang.String>
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    public static List<String> getAllAttr() {
        List<String> allAttr = new ArrayList<>();
        for (PaySheetEnum cache : values()) {
            allAttr.add(cache.attr);
        }
        return allAttr;
    }

    /**
     * 得到新建or编辑时各种付款单禁止修改的字段
     * 具体见文档：https://xbb.yuque.com/lfwuxq/vsf9sv/pmq6pf#XhfVx
     * @param addUnableEdit true 新增是禁止编辑，false 编辑时各类型付款单不能编辑的字段
     * @param sheetTypeEnum 类型
     * @return java.util.List<java.lang.String>
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    public static List<String> getUnableEditAttrList(boolean addUnableEdit, SheetTypeEnum sheetTypeEnum) {
        if (addUnableEdit) {
            //新增时各类型付款单不能编辑的字段
            switch (sheetTypeEnum) {
                case RED_WRITE_OFF_PAY:
                case RED_WRITE_OFF_PREPAY:
                    return Arrays.asList(PAY_PLAN.attr, PAY_PLAN_LINK_TEXT.attr, ORIGIN_ID.attr, ORIGIN_ID_LINK_TEXT.attr, LINK_SUPPLIER.attr, SUPPLIER_LINK_TEXT.attr, LINK_PURCHASE.attr, PURCHASE_LINK_TEXT.attr);
                case RED_PREPAY:
                    return Arrays.asList(PAY_PLAN.attr, PAY_PLAN_LINK_TEXT.attr, ORIGIN_ID.attr, ORIGIN_ID_LINK_TEXT.attr, LINK_SUPPLIER.attr, SUPPLIER_LINK_TEXT.attr);
                case BAD_PAY:
                    return Arrays.asList(PAY_PLAN.attr, PAY_PLAN_LINK_TEXT.attr, AMOUNT.attr);
                default:
                    return Arrays.asList(PAY_PLAN.attr, PAY_PLAN_LINK_TEXT.attr);
            }
        } else {
            List<String> unableEditAttrList = new ArrayList<>();
            unableEditAttrList.add(PAY_SHEET_TYPE.attr);
            unableEditAttrList.add(PAY_PLAN_NO.attr);
            unableEditAttrList.add(LINK_SUPPLIER.attr);
            unableEditAttrList.add(SUPPLIER_LINK_TEXT.attr);
            unableEditAttrList.add(LINK_PURCHASE.attr);
            unableEditAttrList.add(PURCHASE_LINK_TEXT.attr);
            unableEditAttrList.add(PAY_PLAN.attr);
            unableEditAttrList.add(PAY_PLAN_LINK_TEXT.attr);
            unableEditAttrList.add(AMOUNT.attr);
            unableEditAttrList.add(WRITE_OFF_AMOUNT.attr);
            unableEditAttrList.add(BELONG_ID.attr);
            unableEditAttrList.add(REAL_PAY_TIME.attr);
            unableEditAttrList.add(FUND_ACCOUNT.attr);
            //再加上红冲的，关联原始单据
            unableEditAttrList.add(ORIGIN_ID.attr);
            unableEditAttrList.add(ORIGIN_ID_LINK_TEXT.attr);
            //负责人、协同人字段
            unableEditAttrList.add(OWNER_ID.attr);
            unableEditAttrList.add(COUSERID.attr);
            return unableEditAttrList;
        }
    }

    /**
     * 审批流程内不可编辑，必可见字段
     * @return java.util.List<java.lang.String>
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    public static List<String> processNoneEditMustShow(){
        return Arrays.asList(PAY_SHEET_TYPE.attr, LINK_SUPPLIER.attr, SUPPLIER_LINK_TEXT.attr, LINK_PURCHASE.attr, PURCHASE_LINK_TEXT.attr, PAY_PLAN.attr, PAY_PLAN_LINK_TEXT.attr, AMOUNT.attr, WRITE_OFF_AMOUNT.attr, BELONG_ID.attr);
    }

    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }

    public String getI18nAttrName() {
        return attrName;
    }

    public static String getI18nValue(String value) {
        return I18nMessageUtil.getMessage(value);
    }

    public static List<String> getAttrs() {
        List<String> attrs = new ArrayList<>();
        for (PaySheetEnum paySheetEnum : values()) {
            attrs.add(paySheetEnum.getAttr());
        }
        return attrs;
    }
}
